import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import util from "@/utils/util";


//表格列名
export const columns: BasicColumn[] = [
  {
    title: '用户名',
    dataIndex: 'userName',
    width: 130,

  },
  {
    title: '试卷名称',
    dataIndex: 'paperName',
  },
  {
    title: '得分',
    dataIndex: 'score',
    width: 130,
  },
  {
    title: '创建时间',
    width: 160,
    dataIndex: 'createTime',
  },
  {
    title: '交卷时间',
    width: 160,
    dataIndex: 'endTime',
  },

];


/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '人员类型',
    field: 'type',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '学历',
    field: 'education',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '工作经验',
    field: 'workNum',
    align: 'center',
  },
  {
    title: '管理经验',
    field: 'manageNum',
    align: 'center',
  },
  {
    title: '专业经验',
    field: 'specialtyNum',
    align: 'center',
  },
  {
    title: '历史业绩',
    field: 'history',
    align: 'center',
  },
  {
    title: '专业相符',
    field: 'specialtyMatching',
    align: 'center',
  },
  {
    title: '创建时间',
    field: 'createTime',
    width: 180,
    align: 'center',
  },
  {
    width: 120,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];


export const vxeTableColumns2: VxeGridPropTypes.Columns = [
  {
    title: '人员类型',
    field: 'type',
    showOverflow: 'title',
    align: 'center',
  },
  // {
  //   title: '评价级别',
  //   field: 'level',
  //   showOverflow: 'title',
  //   align: 'center',
  // },

  {
    title: '1',
    field: '1',
    align: 'center',
  },
  {
    title: '2',
    field: '2',
    align: 'center',
  },
  {
    title: '3',
    field: '3',
    align: 'center',
  },
  {
    title: '4',
    field: '4',
    align: 'center',
  },
  {
    title: '5',
    field: '5',
    align: 'center',
  },
  {
    title: '6',
    field: '6',
    align: 'center',
  },
];



export const searchFormSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '姓名',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'paperName',
    label: '试卷名称',
    component: 'Input',
    colProps: { span: 8 },
  },

];


export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'keyword',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '部门/岗位',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [
  {
    field: 'type',
    label: '人员类型',
    component:"Select",
    componentProps: {
      options: [
        { label: '管理人员', value: '管理人员' },
        { label: '技术人员', value: '技术人员' },
        { label: '其他人员', value: '其他人员' },
      ],
    },
    required: true,
  },
  {
    field: 'education',
    label: '学历/职称',
    component:"Input",
    required: true,
  },
  {
    field: 'workNum',
    label: '工作经验',
    component:"Input",
    required: true,
  },
  {
    field: 'manageNum',
    label: '管理经验',
    component:"Input",
    required: false,
  },
  {
    field: 'specialtyNum',
    label: '专业经验',
    component:"Input",
    required: true,
  },

  {
    field: 'specialtyMatching',
    label: '专业相符',
    component:"Input",
    required: true,
  },
  {
    field: 'history',
    label: '历史业绩',
    component:"Input",
    required: true,
  },


];



export const teamUserColumns: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '标题',
    field: 'title',
    showOverflow: 'title',
    align: 'center',
    // width: 150,
  },
  {
    title: '审批结果',
    field: 'result',
    showOverflow: 'title',
    align: 'center',
    slots:{
      default({row}) {
        let color="",text="";
        if(row.result=='agree'){
          text="同意";
          color="green";
        }else{
          text=row.result;
        }
        return h(Tag,{color},text)
      },
    },
    width: 80,
  },
  {
    title: '审批编号',
    field: 'approveNo',
    showOverflow: 'title',
    align: 'center',
    width: 150,
  },
  {
    title: '发起时间',
    field: 'addTime',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '原职位',
    field: 'original_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '转入职位',
    field: 'now_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  // {
  //   width: 120,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
  ]
